package com.example.ass7.dataloader;

import java.awt.Color;
import java.awt.Image;

import biuoop.DrawSurface;

import com.example.ass7.sprite.Sprite;

/**
 * @author Meirav Ben Izhak
 */
public class Background implements Sprite {

    private final Image image;
    private final Color color;

    /**
     * @param image
     *            image
     * @param color
     *            color
     */
    public Background(
        Image image, Color color) {
        this.image = image;
        this.color = color;
    }

    @Override
    public void drawOn(DrawSurface d) {
        if (this.image != null) {
            d.drawImage(0,
                    0,
                    this.image);
        } else if (this.color != null) {
            d.setColor(this.color);
            d.fillRectangle(0,
                    0,
                    800,
                    600);
        }
    }

    @Override
    public void timePassed(double dt) {
        // empty
    }

    /**
     * @return Image
     */
    public Image getImage() {
        return this.image;
    }

    /**
     * @return Color
     */
    public Color getColor() {
        return this.color;
    }

}
